package com.iwayin.core.dao.vote;

import java.util.List;

import com.iwayin.core.dao.BaseDAOImpl;
import com.iwayin.core.dataobject.AnswerDO;
import com.iwayin.core.dataobject.AnswerVoteDO;

public class AnswerVoteDAOImpl extends BaseDAOImpl implements AnswerVoteDAO {

	@Override
	public AnswerVoteDO getByAskIdUserId(AnswerVoteDO vote) {
		return (AnswerVoteDO) this.queryForObject("AnswerVoteDAO.getByAskIdUserId", vote);
	}

	@Override
	public Integer updateVoteByAskIdUserId(AnswerVoteDO vote) {
		return this.executeUpdate("AnswerVoteDAO.updateVoteByAskIdUserId", vote);
	}

	@Override
	public void addAnswerVote(AnswerVoteDO vote) {
		this.executeInsert("AnswerVoteDAO.addAnswerVote", vote);
	}

	@Override
	public Integer deleteVoteByAskId(Long askId) {
		return executeDelete("AnswerVoteDAO.deleteVoteByAskId", askId);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<AnswerVoteDO> findAskVotesByAskId(AnswerDO query) {
		return (List<AnswerVoteDO>)executeQueryForList("AnswerVoteDAO.findAskVotesByAskId", "AnswerVoteDAO.findAskVotesByAskId.count",query);
	}

}
